package com.ricky;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.context.annotation.PropertySources;

/**
 * Created by bgt on 2018/5/1.
 */
@Configuration
@PropertySources({
        @PropertySource("classpath:jdbc.properties"),
        @PropertySource("file:/d:/work/java/jdbc2.properties")
})
public class PropertiesConfig implements InitializingBean{
    @Value("${user}")
    private String user;
    @Value("${user2}")
    private String user2;

    @Override
    public void afterPropertiesSet() throws Exception {
        System.out.println("user:"+user);
        System.out.println("user2:"+user2);
    }
}
